package live.zs.tkmybatisboot.controller;

import live.zs.tkmybatisboot.entity.TbUser;
import live.zs.tkmybatisboot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author madison
 * @description
 * @date 2021/7/8 23:30
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    // http://localhost:8112/user/list
    @GetMapping("list")
    public List<TbUser> list() {
        return userService.selectUsers();
    }


    // http://localhost:8112/user/save
    @PutMapping("save")
    public int save(@RequestBody TbUser user) {
        return userService.saveUser(user);
    }
}
